Skip to content

tls: fix abort on negative zero sessionTimeout - #67661

Open
JuHyeong424 wants to merge 1 commit into
nodejs:mainfrom
JuHyeong424:tls-negative-zero
Open

JuHyeong424 wants to merge 1 commit into
nodejs:mainfrom
JuHyeong424:tls-negative-zero

Conversation

@JuHyeong424

Copy link
Copy Markdown

validateInt32() accepts -0, but the binding asserts IsInt32(), which V8 reports as false for -0, so the process aborts. Coerce the value to +0 before passing it to setSessionTimeout().

Reproduction

require('tls').createSecureContext({ sessionTimeout: -0 });

On v26.13.1:

# node::crypto::SecureContext::SetSessionTimeout(...) at ../src/crypto/crypto_context.cc:2340
# Assertion failed: args[0]->IsInt32()

The abort cannot be caught with try/catch.

Same class of fix as #65888 (fs) and #67651 (os).

Added test/parallel/test-tls-negative-zero.js.

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/crypto
  • @nodejs/net

@nodejs-github-bot nodejs-github-bot added needs-ci PRs that need a full CI run. tls Issues and PRs related to the tls subsystem. labels Nov 20, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Welcome to Node.js, and thank you for your first contribution!

Before review, please take a moment to read:

Please make sure every commit is signed off. For a first pull request, GitHub Actions require collaborator approval and Jenkins CI must be started by a collaborator or triager, so an initial wait is normal.

validateInt32() accepts -0, but the binding asserts IsInt32(),
which V8 reports as false for -0, so the process aborts. Coerce
the value to +0 before passing it to setSessionTimeout().

Signed-off-by: JuHyeong424 <wkdwngud963@gmail.com>

@Ethan-Arrowood Ethan-Arrowood left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm; agree this is similar to the other recently merged #65888

@Ethan-Arrowood Ethan-Arrowood added the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Nov 20, 2026
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Nov 20, 2026
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@codecov

codecov Bot commented Nov 20, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.60%. Comparing base (dcaf43a) to head (2ae6a54).
⚠️ Report is 5 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #67661      +/-   ##
==========================================
- Coverage   90.61%   90.60%   -0.01%     
==========================================
  Files         801      801              
  Lines      280966   280967       +1     
  Branches    54233    54224       -9     
==========================================
- Hits       254592   254581      -11     
- Misses      16566    16574       +8     
- Partials     9808     9812       +4     
Files with missing lines Coverage Δ
lib/internal/tls/secure-context.js 96.16% <100.00%> (+0.01%) ⬆️

... and 36 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-ci PRs that need a full CI run. tls Issues and PRs related to the tls subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants